package com.lagou.service;

import com.lagou.dao.ArticleRepository;
import com.lagou.pojo.Article;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ArticleService {

    @Autowired
    private ArticleRepository articleRepository;

    public List<Article> getAll(Integer page){
        List<Article> list =articleRepository.findAll();
        return list.size()> (page*3+1) ? list.subList((page-1)*3,page*3) : list.subList((page-1)*3,list.size());
    }

}
